]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
panel: Add keyboard shortcut to open app menu
authorFlorian Müllner <fmuellner@gnome.org>
Tue, 27 Mar 2012 13:26:20 +0000 (15:26 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Fri, 30 Mar 2012 17:58:43 +0000 (19:58 +0200)
With the application menu now being more than a stub, it has
become a much more interesting target, so add a keyboard shortcut
to open it directly.
This should also ease some of the pain for focus-follows-mouse users.

https://bugzilla.gnome.org/show_bug.cgi?id=672909

data/org.gnome.shell.gschema.xml.in
js/ui/panel.js
js/ui/windowManager.js

index acf6adeb5cafb92e580a772219c564b756fb7588..92a239f2501685e35f38a8e6e5e9e60b9581e3da 100644 (file)
@@ -64,6 +64,7 @@ value here is from the GsmPresenceStatus enumeration.</_summary>
     <child name="clock" schema="org.gnome.shell.clock"/>
     <child name="calendar" schema="org.gnome.shell.calendar"/>
     <child name="recorder" schema="org.gnome.shell.recorder"/>
+    <child name="keybindings" schema="org.gnome.shell.keybindings"/>
     <child name="keyboard" schema="org.gnome.shell.keyboard"/>
   </schema>
 
@@ -78,6 +79,17 @@ value here is from the GsmPresenceStatus enumeration.</_summary>
       </key>
   </schema>
 
+  <schema id="org.gnome.shell.keybindings" path="/org/gnome/shell/keybindings/"
+          gettext-domain="@GETTEXT_PACKAGE@">
+    <key name="open-application-menu" type="as">
+      <default>["&lt;Super&gt;F10"]</default>
+      <_summary>Keybinding to open the application menu</_summary>
+      <_description>
+        Keybinding to open the application menu.
+      </_description>
+    </key>
+  </schema>
+
   <schema id="org.gnome.shell.keyboard" path="/org/gnome/shell/keyboard/"
           gettext-domain="@GETTEXT_PACKAGE@">
     <key name="keyboard-type" type="s">
index ef240a5e0a167b99f4f1f0782824ae5b9c777ab7..329f118fcb7042af1c65c3c45b854399fb32babd 100644 (file)
@@ -4,6 +4,7 @@ const Cairo = imports.cairo;
 const Clutter = imports.gi.Clutter;
 const Gio = imports.gi.Gio;
 const GLib = imports.gi.GLib;
+const Gtk = imports.gi.Gtk;
 const Lang = imports.lang;
 const Mainloop = imports.mainloop;
 const Meta = imports.gi.Meta;
@@ -1112,6 +1113,15 @@ const Panel = new Lang.Class({
         return true;
     },
 
+    openAppMenu: function() {
+        let menu = this._appMenu.menu;
+        if (Main.overview.visible || menu.isOpen)
+          return;
+
+        menu.open();
+        menu.actor.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false);
+    },
+
     startStatusArea: function() {
         for (let i = 0; i < this._status_area_order.length; i++) {
             let role = this._status_area_order[i];
index 69f8e194feb0b3d82e8ab0fddbd6c3dc8d96921a..1e2b2f447aab5a210d377e8991632ab1a2efb884 100644 (file)
@@ -13,6 +13,7 @@ const WorkspaceSwitcherPopup = imports.ui.workspaceSwitcherPopup;
 const Main = imports.ui.main;
 const Tweener = imports.ui.tweener;
 
+const SHELL_KEYBINDINGS_SCHEMA = 'org.gnome.shell.keybindings';
 const WINDOW_ANIMATION_TIME = 0.25;
 const DIM_TIME = 0.500;
 const UNDIM_TIME = 0.250;
@@ -134,6 +135,10 @@ const WindowManager = new Lang.Class({
                                             Lang.bind(this, this._startAppSwitcher));
         Meta.keybindings_set_custom_handler('switch-panels',
                                             Lang.bind(this, this._startA11ySwitcher));
+        global.display.add_keybinding('open-application-menu',
+                                      SHELL_KEYBINDINGS_SCHEMA,
+                                      Meta.KeyBindingFlags.NONE,
+                                      Lang.bind(this, this._openAppMenu));
 
         Main.overview.connect('showing', Lang.bind(this, function() {
             for (let i = 0; i < this._dimmedWindows.length; i++)
@@ -547,6 +552,10 @@ const WindowManager = new Lang.Class({
         Main.ctrlAltTabManager.popup(backwards, binding.get_mask());
     },
 
+    _openAppMenu : function(display, screen, window, event, binding) {
+        Main.panel.openAppMenu();
+    },
+
     _showWorkspaceSwitcher : function(display, screen, window, binding) {
         if (screen.n_workspaces == 1)
             return;